const path=require('path')
//这个配置文件，就是一个js文件，通过node中的模块操作，向外暴露了一个配置对象
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const htmlWebpackPlugin=require('html-webpack-plugin')//只要是插件，都一定要放到plugins节点中去
module.exports={
    entry:path.join(__dirname,'./src/main.js'),
    output:{
        path:path.join(__dirname,'./dist'),
        filename:'bundle.js'
    },
    plugins:[
        new htmlWebpackPlugin({
            template:path.join(__dirname,'./src/index.html'),
            filename:'index.html'
        }),
        new VueLoaderPlugin()
    ],
    module:{
        rules:[
            {test:/\.css$/,use:['style-loader','css-loader']},
            {test:/\.(jpg|png|gif|bmp|jpeg)$/,use:'url-loader?limit=1489231&name=[hash:8]-[name].[ext]'},
            {test:/\.js$/,use:'babel-loader',exclude:/node_modules/},
            {test:/\.vue$/,use:'vue-loader'},
            {test:/\.(ttf|eot|svg|woff|woff2)$/,use:'url-loader'}
        ]
    },
    resolve:{
        alias:{
            // "vue$":"vue/dist/vue.js"
        }
    }
}